bitkeeper revision 1.1159.1.410 (41938f11lquB4JbUCks0P4VZ_1uKlg)
authorcl349@freefall.cl.cam.ac.uk <cl349@freefall.cl.cam.ac.uk>
Thu, 11 Nov 2004 16:10:57 +0000 (16:10 +0000)
committercl349@freefall.cl.cam.ac.uk <cl349@freefall.cl.cam.ac.uk>
Thu, 11 Nov 2004 16:10:57 +0000 (16:10 +0000)
Make set_timeout_timer SMP safe.
Also disable AP timer interrupt code for now.

linux-2.6.9-xen-sparse/arch/xen/i386/kernel/time.c

index ea049218e0b71f6c3db69defee38105374d3fcc7..3dab3891156a3c778b29882b08a32c8f4cf579e2 100644 (file)
@@ -660,15 +660,27 @@ int set_timeout_timer(void)
 {
        u64 alarm = 0;
        int ret = 0;
+#ifdef CONFIG_SMP
+       unsigned long seq;
+#endif
 
        /*
         * This is safe against long blocking (since calculations are
         * not based on TSC deltas). It is also safe against warped
         * system time since suspend-resume is cooperative and we
-        * would first get locked out. It is safe against normal
-        * updates of jiffies since interrupts are off.
+        * would first get locked out.
         */
+#ifdef CONFIG_SMP
+       do {
+               seq = read_seqbegin(&xtime_lock);
+               if (smp_processor_id())
+                       alarm = __jiffies_to_st(jiffies + 1);
+               else
+                       alarm = __jiffies_to_st(jiffies + 1);
+       } while (read_seqretry(&xtime_lock, seq));
+#else
        alarm = __jiffies_to_st(next_timer_interrupt());
+#endif
 
        /* Failure is pretty bad, but we'd best soldier on. */
        if ( HYPERVISOR_set_timer_op(alarm) != 0 )
@@ -707,20 +719,26 @@ void time_resume(void)
 static irqreturn_t local_timer_interrupt(int irq, void *dev_id,
                                         struct pt_regs *regs)
 {
+#if 0
        static int xxx = 0;
-       if ((xxx++ % 100) == 0)
-               xxprint("local_timer_interrupt\n");
+       if ((xxx++ % 2000) == 0)
+               printk("local_timer_interrupt %d\n", xxx);
+#endif
 
        /*
         * update_process_times() expects us to have done irq_enter().
         * Besides, if we don't timer interrupts ignore the global
         * interrupt lock, which is the WrongThing (tm) to do.
         */
-       irq_enter();
+       // irq_enter();
        /* XXX add processed_system_time loop thingy */
-       if (regs)
-               update_process_times(user_mode(regs));
-       irq_exit();
+       // if (regs)
+       //      update_process_times(user_mode(regs));
+       // irq_exit();
+       if (smp_processor_id() == 0) {
+           xxprint("bug bug\n");
+           BUG();
+       }
 
        return IRQ_HANDLED;
 }